package com.ruimei.controller;

import com.alibaba.fastjson.JSONArray;
import com.ruimei.entitys.Clock;
import com.ruimei.entitys.Teacher;
import com.ruimei.service.ClockService;
import com.ruimei.util.TokenUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Api(tags={"早晚自习打卡"})
@Controller
public class ClockController {
    @Resource
    ClockService clockService;
    @Resource
    private RedisTemplate<String,String> redisTemplate;

    @ApiOperation("添加打卡信息")
    @PostMapping({"/clock/add"})
    @ResponseBody
    public Map<String, Object> addClock(Clock clock)
    {
            Map<String, Object> map = clockService.addClock(clock);
            return map;
    }
    @ApiOperation("查询打卡信息")
    @PostMapping({"/clock/get"})
    @ResponseBody
    public Map<String, Object> getClock(String id,String type,String classId,String teacherName,String btime,String etime)
    {

            Map<String, Object> map = clockService.getClock(id,type,classId,teacherName,btime,etime);
            return map;

    }

    @ApiOperation("删除打卡信息")
    @PostMapping({"/clock/delete"})
    @ResponseBody
    public Map<String, Object> deleteClock(Clock clock)
    {
        Map<String, Object> map = clockService.deleteClock(clock);
        return map;
    }
}
